<cfcomponent displayname="ESAPI" hint="ESAPI locator class to make it easy to get a concrete implementation of the various ESAPI classes." output="false">
	<cffunction name="init" access="public" returntype="ESAPI" output="false" hint="Instantiates the object and loads it with the security services">
		<cfargument name="configPath" type="string" required="true" hint="Path to the config file" />
		
		<cfset var configXML = "" />
		<cfset var config = "" />
        
		
		<cffile action="read" file="#configPath#" charset="UTF-8" variable="configXML" />
		
		<cfif NOT IsXML(configXML)><cfthrow message="Invalid Config File"></cfif>
		
		<cfset config = XMLParse(configXML) />
			
		<cfset variables.SecurityConfiguration = createObject("component","cfesapi.org.owasp.esapi.SecurityConfiguration").init(config) />
		<cfset variables.LogFactory = createObject("component","cfesapi.org.owasp.esapi.LogFactory").init(this) />
		<cfset variables.Executor = createObject("component","cfesapi.org.owasp.esapi.Executor") />
        <cfset variables.Encoder = createObject("component","cfesapi.org.owasp.esapi.Encoder").init() />
		<cfset variables.HTTPUtilities = createObject("component","cfesapi.org.owasp.esapi.HTTPUtilities").init(this) />
		
		<cfset variables.Validator = createObject("component","cfesapi.org.owasp.esapi.Validator").init() />
		<cfset variables.Authenticator = createObject("component","cfesapi.org.owasp.esapi.Authenticator").init(this) />

		
		<cfset variables.logger = variables.LogFactory.getLogger("ESAPI") />
		
		<cfset variables.sessionFacade = createObject("component", "cfesapi.org.owasp.esapi.sessionFacade").init() />
		
		<cfreturn this />	
	</cffunction>

	<cffunction name="authenticator" access="public" returntype="cfesapi.org.owasp.esapi.Authenticator" output="false">
		<cfreturn variables.Authenticator />
	</cffunction>
	
	<cffunction name="setAuthenticator" access="public" returntype="void" output="false">
		<cfargument name="Authenticator" type="cfesapi.org.owasp.esapi.Authenticator" />
		
	</cffunction>
	
    <cffunction name="encoder" access="public" returntype="cfesapi.org.owasp.esapi.Encoder" output="false">
	  <cfreturn variables.Encoder />
	</cffunction>
	
	<cffunction name="setEncoder" access="public" returntype="void" output="false">
		<cfargument name="Encoder" type="cfesapi.org.owasp.esapi.Validator" />
	</cffunction>
    
	<cffunction name="encryptor" access="public" returntype="cfesapi.org.owasp.esapi.Encryptor" output="false">
	
	</cffunction>

	<cffunction name="setEncryptor" access="public" returntype="void" output="false">
		<cfargument name="Encryptor" type="cfesapi.org.owasp.esapi.Encryptor" />
	</cffunction>
	
	<cffunction name="executor" access="public" returntype="cfesapi.org.owasp.esapi.Executor" output="false">
	
	</cffunction>
	
	<cffunction name="setExecutor" access="public" returntype="void" output="false">
		<cfargument name="Executor" type="cfesapi.org.owasp.esapi.Executor" />
	</cffunction>
	
	<cffunction name="httpUtilities" access="public" returntype="cfesapi.org.owasp.esapi.HTTPUtilities" output="false">
	
	</cffunction>
	
	<cffunction name="setHTTPUtilities" access="public" returntype="void" output="false">
		<cfargument name="HTTPUtilities" type="cfesapi.org.owasp.esapi.HTTPUtilities" />
	</cffunction>
	
	<cffunction name="logFactory" access="private" returntype="cfesapi.org.owasp.esapi.LogFactory" output="false">
		
	</cffunction>
	
	<cffunction name="setLogFactory" access="public" returntype="void" output="false">
		<cfargument name="LogFactory" type="cfesapi.org.owasp.esapi.LogFactory" />
	</cffunction>
	
	<cffunction name="getLogger" access="public" returntype="any" output="false">
		<cfargument name="loggerType" required="false" type="string" default="generic" hint="The name of the type of logger" />
	
		<cfreturn variables.logFactory.getLogger(arguments.loggerType) />	
	</cffunction>
	
	<cffunction name="logger" access="public" returntype="cfesapi.org.owasp.esapi.Logger" output="false">
		<cfreturn variables.logger>
	</cffunction>
	
	<cffunction name="securityConfiguration" access="public" returntype="cfesapi.org.owasp.esapi.SecurityConfiguration" output="false">
		<cfreturn variables.SecurityConfiguration />
	</cffunction>
	
	<cffunction name="setSecurityConfiguration" access="public" returntype="void" output="false">
		<cfargument name="SecurityConfiguration" type="cfesapi.org.owasp.esapi.SecurityConfiguration" />
	</cffunction>
	
	<cffunction name="validator" access="public" returntype="cfesapi.org.owasp.esapi.Validator" output="false">
	  <cfreturn variables.Validator />
	</cffunction>
	
	<cffunction name="setValidator" access="public" returntype="void" output="false">
		<cfargument name="Validator" type="cfesapi.org.owasp.esapi.Validator" />
	</cffunction>

	<cffunction name="sessionFacade" access="public" returntype="cfesapi.org.owasp.esapi.sessionFacade" output="false">
		<cfreturn variables.sessionFacade />
	</cffunction>
</cfcomponent>